Skip to content

Revert app harness subprocess#5610

Merged
adhami3310 merged 2 commits into
mainfrom
revert-app-harness-subprocess
Jul 21, 2025
Merged

Revert app harness subprocess#5610
adhami3310 merged 2 commits into
mainfrom
revert-app-harness-subprocess

Conversation

@adhami3310
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR represents a significant architectural change to the testing infrastructure in Reflex, specifically reverting the app harness subprocess implementation. The changes move away from managing the backend server through subprocesses to a more direct, thread-based approach within the same process. Key modifications include:

  1. Removing subprocess-based backend management in AppHarness in favor of direct uvicorn server management
  2. Simplifying error logging by consolidating separate error logs into a single logging stream
  3. Streamlining command construction for Gunicorn and Granian servers in production mode
  4. Updating all integration tests to work with the new thread-based backend approach
  5. Improving test robustness by adding automatic console.error detection

The changes affect multiple test files and core utilities, making the testing infrastructure more maintainable and reliable while reducing complexity in process management and logging.

Confidence score: 4/5

  1. This PR is relatively safe to merge as it primarily affects testing infrastructure rather than production code.
  2. The high score reflects the comprehensive test updates and improved error handling, though the complexity of process management changes warrants careful review.
  3. Key files needing attention:
    • reflex/testing.py: Core changes to AppHarness implementation
    • reflex/utils/exec.py: Changes to server command construction
    • reflex/utils/console.py: Error logging modifications

17 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

if not external_scripts_path.exists():
external_scripts_path.parent.mkdir(parents=True, exist_ok=True)
external_scripts_path.write_text(external_scripts)
Path("assets/external.js").write_text(external_scripts)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: If parent directory doesn't exist, write_text() will raise FileNotFoundError. Consider using parent.mkdir(exist_ok=True) or Path('assets').mkdir(exist_ok=True) before writing.

Suggested change
Path("assets/external.js").write_text(external_scripts)
Path("assets/external.js").parent.mkdir(parents=True, exist_ok=True)
Path("assets/external.js").write_text(external_scripts)

)
elif isinstance(client_side.state_manager, (StateManagerMemory, StateManagerDisk)):
client_side.state_manager.states.pop(token, None)
del client_side.state_manager.states[token]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: direct dict deletion is more concise but could raise KeyError if token doesn't exist - consider dict.pop(token, None) for safety

import pytest
from playwright.sync_api import Page, expect

import reflex as rx
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider moving rx import to top of imports section with other third-party packages

Copy link
Copy Markdown
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 21, 2025

CodSpeed Performance Report

Merging #5610 will not alter performance

Comparing revert-app-harness-subprocess (b88ef45) with main (fa41274)

Summary

✅ 8 untouched benchmarks

@adhami3310 adhami3310 merged commit f1eaab5 into main Jul 21, 2025
39 of 41 checks passed
@adhami3310 adhami3310 deleted the revert-app-harness-subprocess branch July 21, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants